import time


from selenium.webdriver.common.by import By
from selenium import webdriver
from Base.Base import Base


class Page1(Base):

    #点击请登录
    login_loc=(By.XPATH,'/html/body/div[2]/div/div[1]/div/a[1]')
    def login(self):
        self.sbclick(self.login_loc)
    #输入账号
    user_loc=(By.ID,'userName')
    def username(self,username):
        self.send_keys(self.user_loc,username)
    #输入密码
    pass_loc=(By.ID,'password')
    def password(self,password):
        self.send_keys(self.pass_loc,password)
    #点击登录
    loginan_loc=(By.XPATH,'/html/body/div/form/div/div/div/div/div[1]/div[2]/div[4]/input')
    def loginan(self):
        self.click(self.loginan_loc)
    #点击确认
    qr_loc=(By.ID,'bindSub')
    def qr(self):
        self.click(self.qr_loc)
    #断言
    dy_loc=(By.XPATH,'/html/body/div[2]/div/div[1]/div/a[1]')
    def dy(self):
        self.text(self.dy_loc)

    def luoji_jiuxian_login(self,username,password):
        self.open_url('https://login.jiuxian.com/')
        time.sleep(5)
        self.login()
        time.sleep(4)
        self.username(username=username)
        self.password(password=password)
        time.sleep(15)
        self.loginan()
        time.sleep(3)
        # self.qr()
        # time.sleep(10)
        # self.dy()
